home *** CD-ROM | disk | FTP | other *** search
/ Network Supervisor's Toolkit / Network Supervisor's Toolkit.iso / tools / lu62 / attlnck.c < prev    next >
C/C++ Source or Header  |  1996-07-10  |  3KB  |  87 lines

  1. /*******************************************************************/
  2. /*                                                                 */
  3. /*                                                                 */
  4. /*     ATTACH_LENGTH_CHECK                                         */
  5. /*                                                                 */
  6. /* Function: this procedure checks the lengths of the fields in    */
  7. /* the ATTACH header                                               */
  8. /*                                                                 */
  9. /* input :   the FMH-5 attach header                               */
  10. /*                                                                 */
  11. /* output:   return code :                                         */
  12. /*                x'00000000'  no error                             */
  13. /*                x'10086000'  fmh length not corrected             */
  14. /*  not used      x'10086005'  access security information length   */
  15. /*                             is invalid                           */
  16. /*                x'10086009'  an invalid parameter length          */
  17. /*   not used     x'10086011'  an invalid value for the "logical    */
  18. /*                                             unit of work"        *
  19.  *                                                                  *
  20.  * CopyRight 1995. Nicholas Poljakov all rights reserved.           *
  21.  *                                                                  *
  22.  ********************************************************************/
  23. #include <fmh5.h>
  24. #include <state1.h>
  25. #include <string.h>
  26.  
  27. unsigned long attltck(att_ptr)
  28. char *att_ptr;
  29. {
  30. struct FMH5 *a_ptr;
  31. unsigned long code;
  32. unsigned offset;
  33.  
  34. #if OS_TYPE == 1
  35. /*********  Trace facility **********/
  36. unsigned int rtype;   /* type of record */
  37. unsigned int pnum;    /* point number */
  38. char pname[8];        /* name of module */
  39. char *drec;       /* record for dump */
  40. int  lenr;            /* record length */
  41.  
  42. rtype = INPROC;
  43. strcpy(pname, "attlnck");
  44. pnum = 1;
  45. drec = att_ptr;
  46. lenr = 200;
  47. gtf(rtype, pname, pnum, drec, lenr);
  48. /***********************************/
  49. #endif
  50.  
  51.  
  52. code = 0;
  53. a_ptr = (struct FMH5 *)att_ptr;
  54. offset=5;
  55. if (a_ptr -> length <= offset)
  56.     {
  57.        code=0x10086000;  /*fmh  length is invalid*/
  58.        goto exit_pgn;
  59.     }
  60.  
  61.      if  (a_ptr -> lnflp < 3)
  62.      {
  63.      code=0x10086009;   /*invalid param length*/
  64.      goto exit_pgn;
  65.      }
  66.  
  67.      offset += (a_ptr -> lnflp) + 1;   /*+value of the fixed length*/
  68.                                        /*the tp name length field*/
  69. if   (a_ptr -> length <= offset)
  70.      {
  71.      code=0x10086000;                  /*fmh length is invalid   */
  72.      goto exit_pgn;
  73.      }
  74.  
  75.      offset += (a_ptr -> lntpn) + 1;   /*+tp name length field */
  76.                                        /*access  securuty  field*/
  77.  
  78.  if  (a_ptr -> length < offset)
  79.       {
  80.       code=0x10086000;                 /*fmh length is invalid  */
  81.       goto exit_pgn;
  82.       }
  83.  /* Here we not use an "access security" and a "logical unit of work" */
  84. exit_pgn :
  85.   return(code);
  86. }
  87.